import { ApiProperty } from '@nestjs/swagger'
import { IsString, MaxLength, IsDecimal, IsInt } from 'class-validator'
import { CategoryEntity } from 'src/entities/category.entity'
import { ProductEntity } from 'src/entities/product.entity'
import { ProductSkuEntity } from 'src/entities/productSkuEntity.entity'

export class createProductDto {
  @ApiProperty()
  @IsString()
  name: string
  @ApiProperty()
  @IsString()
  tab_name: string
  @ApiProperty()
  @IsString()
  img_url: string
  @ApiProperty()
  @IsDecimal()
  price: number
  @ApiProperty()
  @IsDecimal()
  org_price: number
}

export class createCategoryProductDto {
  @ApiProperty()
  @IsString()
  type_name: string

  @ApiProperty()
  @IsString()
  category_name: string

  @ApiProperty()
  @IsString()
  product_name: string

  @ApiProperty()
  @IsString()
  img_url: string

  @ApiProperty()
  @IsString()
  img_url_webp: string

  @ApiProperty()
  @IsString()
  action_type: string

  @ApiProperty()
  @IsString()
  action_path: string
}

export interface ProductSkuDataInterface {
  product: ProductEntity
  categoryList: Array<CategoryEntity>
}

export class addUserSkuDto {
  @ApiProperty({
    description: 'user_product_sku主键ID',
  })
  @IsInt()
  id: number

  @ApiProperty({
    description: '商品数量',
  })
  @IsInt()
  num: number

  @ApiProperty({
    description: '商品sku主键',
  })
  @IsInt()
  sku_id: number
}

export interface productSkuName extends ProductSkuEntity {
  v_idsName: string
}
